package com.itcast.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itcast.constant.MessageConstant;
import com.itcast.dto.MemberLoginDTO;
import com.itcast.entity.Result;
import com.itcast.pojo.Member;
import com.itcast.service.MemberService;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：hongwuyang
 * @date ：2022/4/25 17:33
 * @description：会员
 */
@RestController
@RequestMapping("/member")
public class MemberController {
    @Reference
    MemberService memberService;
    @RequestMapping("/login4EmailAndPwd")
    public Result login4EmailAndPwd(@RequestBody MemberLoginDTO memberLoginDTO){
       return memberService.login4EmailAndPwd(memberLoginDTO);
    }

    @PostMapping("/register")
    public Result registerMember(@RequestBody Member member){
        return memberService.registerMember(member);
    }


    @GetMapping("/getUserDetails")
    public Result getUserDetails(@RequestParam Integer id){
        return memberService.getUserDetails(id);
    }

    @PostMapping("/updateUserDetails")
    public Result updateUserDetails(@RequestBody Member member){
        return memberService.updateUserDetails(member);
    }

}
